const _ = require('lodash');

module.exports = function(db) {
  const collection = db.collection('statistics-arena-seasons');
  const indexes = [
    { key: { uid: 1 }, name: 'uid_1' },
    { key: { season_id: 1 }, name: 'season_id_1' },
    { key: { date: 1 }, name: 'date_1' },
  ];

  collection.createIndexes(indexes);

  return {
    name: 'statisticsArenaSeasons',
    updateArenaSeason: function(selector, update, options) {
      return collection.updateOne(selector, update, {
        upsert: true,
        ...options,
      });
    },
  };
};
